﻿using System.Data.Services;
using System.Data.Services.Common;
using System.Linq;
using System.ServiceModel.Web;
using CQRS.Contract.Data;

namespace CQRS.Host
{
    public class QueryingService : DataService<QueryingContext>
    {
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
            config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
        }

        [WebGet]
        public IQueryable<Customer> FindCustomersViaServiceOperation()
        {
            return new QueryingContext().Customers;
        } 

    }
}
